#include <cstdio>
#include <cstdlib>
#include <string>
#include <memory>
#include "MqttService.h"
#include "MqttOnMessageCallback.hpp"
class Device : public MqttOnMessageCallback
{
public:
    const inline void callback(std::string &topic, std::vector<char> &payload)
    {
        printf("OnMessage:\n\tTopic:%s\n\tPayload:%s\n", topic.c_str(), payload.data());
    };
};

int main()
{
    MqttService mqttService = MqttService::getInstance();
    MqttConnection *p = mqttService.addConnection("test", "broker.emqx.io", true, 1883, MqttService::genUUID(), "username", "password");
    Device device;
    p->subscribe("i/am/test/#", &device);
    while (true)
    {
        p->publish("33333", "123123");
    }
}